//
//  WLDataBaseManager.h
//  WanLian
//
//  Created by 123456 on 2018/12/9.
//  Copyright © 2018 wanlian. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BGFMDB.h"
#define IS_NOT_NULL @"is not null"
NS_ASSUME_NONNULL_BEGIN


@interface WLDataBaseManager : NSObject
decl_single_instance(WLDataBaseManager)

- (BOOL)insertTableName:(NSString *)tableName withModel:(NSObject *)model;
- (BOOL)deleteTableName:(NSString *)tableName withClassName:(Class)className conditionDict:(NSDictionary *)dict;
- (BOOL)updateTableName:(NSString *)tableName withModel:(NSObject *)model conditionDict:(NSDictionary *)dict;
- (NSString *)getConditionStrWithDict:(NSDictionary *)dict;
- (NSArray *)queryTableName:(NSString *)tableName withPage:(int)page className:(Class)className orderBy:(NSString* _Nullable)orderBy desc:(BOOL)desc;
- (NSArray *)queryClassName:(Class)className tableName:(NSString *)tableName fromIndex:(NSInteger)startIndex step:(NSInteger)step orderBy:(NSString* _Nullable)orderBy desc:(BOOL)desc;
- (NSArray *)queryClassName:(Class)className tableName:(NSString *)tableName condition:(NSDictionary *)condictionDict fromIndex:(NSInteger)startIndex step:(NSInteger)step orderBy:(NSString* _Nullable)orderBy desc:(BOOL)desc;
- (NSArray *)queryTotalListWithTableName:(NSString *)tableName className:(Class)className;
- (NSArray *)queryWithTableName:(NSString *)tableName className:(Class)className conditionDict:(NSDictionary *)dict;
/***********异步*********/
- (void)deleteAsynTableName:(NSString *)tableName withClassName:(Class)className conditionDict:(NSDictionary *)dict complete:(bg_complete_B)complete;
- (void)updateAsynTableName:(NSString *)tableName withModel:(NSObject *)model keyPathDict:(NSDictionary *)dict complete:(bg_complete_B)complete;
- (void)insertAsynTableName:(NSString *)tableName withModel:(NSObject *)model complete:(bg_complete_B)complete;

- (NSInteger)countOfTableName:(NSString *)tableName;
- (NSInteger)countOfTableName:(NSString *)tableName condictionDict:(NSDictionary *)condict;
//- (BOOL)updateWithModel:(NSObject *)model;
//- (BOOL)deleteWithModel:(NSObject *)model;
//- (BOOL)insertWithModel:(NSObject *)model;
//- (NSArray *)queryTotalListWithClassName:(Class)className tableName:(NSString *)tableName;
@end

NS_ASSUME_NONNULL_END
